//
// Created by iguilty on 2022-01-14.
//

#ifndef DESIGN_PATTERN_CPP_HANDLE_H
#define DESIGN_PATTERN_CPP_HANDLE_H


class Handle {
public:
    virtual ~Handle();
    virtual void HandleRequest()=0;
    void SetSuccessor(Handle* succ);
    Handle* GetSuccessor();

protected:
    Handle();
    Handle(Handle* succ);

private:
    Handle* _succ;
};

class ConcreteHandleA:public Handle{
public:
    ConcreteHandleA();
    ~ConcreteHandleA();
    ConcreteHandleA(Handle* succ);
    void HandleRequest();
};

class ConcreteHandleB:public Handle{
public:
    ConcreteHandleB();
    ~ConcreteHandleB();
    ConcreteHandleB(Handle* succ);
    void HandleRequest();
};

#endif //DESIGN_PATTERN_CPP_HANDLE_H
